package com.commerceerp.system.api.winit;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.junit.Test;

import java.util.*;

public class GetQueryWarehouse extends BaseHandler
{

    /**
     * 获取仓库信息
     */
    @Test
    public void queryWarehouse() {
        Map<String, Object> data = new TreeMap<String, Object>();
        BaseHandler test = new BaseHandler();
        String result = test.doQuery("queryWarehouse",data);
        JSONObject json = JSONObject.parseObject(result);
        JSONArray array  = (JSONArray)json.get("data");

        List list = new ArrayList();

        for(int i=0;i<array.size();i++){
            JSONObject iObj=array.getJSONObject(i);
            String warehouseCode=iObj.getString("warehouseCode");
            String warehouseId=iObj.getString("warehouseId");
            list.add(warehouseCode+","+warehouseId);
            System.out.println(warehouseCode);
        }
        System.out.println(list.toString());
    }
}
